import 'package:epflutter/pages/home/home.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';

import 'pages/loading.dart';

class Routes {
  // 路由名称
  static String home = '/home/:index';
  static String login = '/login';
  static String register = '/register';
  static String roomDetail = '/roomDetail/:roomId';
  static String setting = '/setting';
  static String roomManage = '/roomManage';
  static String roomAdd = '/roomAdd';
  static String communityPicker = '/communityPicker';
  static String loading = '/loading';
  static Handler _homeHandler =
      Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return HomePage(params['index'][0],
        params['rentType'] == null ? '' : params['rentType'][0]);
  });
  static Handler _loadingHandler =
      Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
    return LoadingPage();
  });
  // 关联路由名称和处理函数
  static void configureRoutes(Router router) {
    router.define(loading, handler: _loadingHandler);
    router.define(home, handler: _homeHandler);
  }
}
